﻿using System;
using System.Linq.Expressions;
using System.Windows.Forms;

namespace WinFormsCommands
{
	public partial class ViewPanelBase : UserControl, IView
	{
		public ViewPanelBase()
		{
			InitializeComponent();
		}

		public CommandProcessor Processor { get; set; }

		public virtual void BindModel(object model)
		{
			throw new NotImplementedException("Views must implement BindModel");
		}

		public virtual void Execute(ICommand command)
		{
			Processor.Messenger.Send(command);
		}

		protected override void OnLoad(System.EventArgs e)
		{
			DoubleBuffered = true;
			base.OnLoad(e);
		}
	}
}
